module game
{
	/**收集每次需要播放动画的pop，在这些pop都移动到指定位置后，告诉场景这次移动已经结束 */
	export class TweenManager extends egret.EventDispatcher
	{
		private static _instance:TweenManager;
		public static TWEEN_COMPLETE:string = "tween_complete";
		private _count:number;
		private _completes:number;

		public constructor()
		{
			super();
			this._count = 0;
			this._completes = 0;
		}

		public static getInstance():TweenManager
		{
			if(this._instance == null)
			{
				this._instance = new TweenManager();
			}
			return this._instance;
		}

		public start():void
		{
			this._count++;
		}

		public complete():void
		{
			this._completes++;

			if(this._completes == this._count)
			{
				console.log('tween_complete');
				this.dispatchEventWith(TweenManager.TWEEN_COMPLETE);
			}
		}
	}
}